package main

import (
	"fmt"
	"time"
)

func main() {
	chan1 := make(chan int, 10)
	chan2 := make(chan int, 3)
	defer close(chan1)
	go func() {
		for index := 0; index < 20; index++ {
			fmt.Println(index)
			chan1 <- index
		}
	}()
	go getChan(chan1, chan2)
	time.Sleep(3 * time.Second)
}

func getChan(chan1 chan int, chan2 chan int) {
	for {
		chan2 <- <-chan1
		fmt.Println()
	}
}
